package com.ums.ribbonconsumer;

import feign.Feign;
import feign.Param;
import feign.RequestLine;
import feign.codec.StringDecoder;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class FeignTest {

    interface GitHub {
        @RequestLine("GET /repos/{owner}/{repo}/contributors")
        List<Contributor> contributors(@Param("owner") String owner, @Param("repo") String repo);
    }

    static class Contributor {
        String login;
        int contributions;
    }

    interface Hello{
        @RequestLine("GET /hello")
        String hello();

        @RequestLine("POST /placeOrder")
        String placeOrder(String body);
    }

    public static void main(String... args) {

        Hello h = Feign.builder().decoder(new StringDecoder()).target(Hello.class,"http://localhost:8080");
        System.out.println("h = " + h.placeOrder("this body"));
    }
}
